import { folders } from "../shared/types/Folder";

export function findFolder(paths:Array<string>,root:folders):folders | undefined{
    paths.shift()//去掉root [a,b,c]
    let currentFolder:folders | undefined = root

    console.log(paths);
    paths.find(path =>{
        const f = currentFolder!.folders.find(folder => folder.name === path)
        currentFolder = f

        if(currentFolder === undefined){
            return true
        }
        else{
            return false
        }
    })

    return currentFolder
}